#!/bin/bash

set +u

echo "--- :golang: Setting up Golang build environment"

if [[ ! -z "${GIMME_GO_VERSION:-}" ]] && [[ "$GIMME_GO_VERSION" != "" ]]; then
  eval "$(.ci/gimme.sh ${GIMME_GO_VERSION})"
else
  echo "No \$GIMME_GO_VERSION set, skipping..."
fi

echo "--- :buildkite: :codecov: environment variables"
export CI="true" # required by codecov.sh

echo "--- Parallelism hooks"
if [[ "$BUILDKITE_PARALLEL_JOB" != "" ]]; then
  export SPLIT_IDX=${BUILDKITE_PARALLEL_JOB}
fi

if [[ "$BUILDKITE_PARALLEL_JOB_COUNT" != "" ]]; then
  export TOTAL_SPLITS=${BUILDKITE_PARALLEL_JOB_COUNT}
fi
